QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport

CONFIG += c++17

# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
    main.cpp \
    widget.cpp \
    qcustomplot.cpp

HEADERS += \
    widget.h \
    qcustomplot.h

FORMS += \
    widget.ui

DAQ_LIB_NMAE=libdaq-2.0.0
DAQ_LIB_ROOT_PATH=$$PWD/../../../../lib
win32 {
    message($$QMAKE_CXX)
    DAQ_LIB_ROOT_PATH=$$DAQ_LIB_ROOT_PATH/Windows/libdaq
    contains(QMAKE_CXX, "cl") {
        message($$QMAKE_MSC_VER)
        # 检查是否为 MSVC 2017
        greaterThan(QMAKE_MSC_VER, 1909) {
            lessThan(QMAKE_MSC_VER, 1920) {
                contains(QT_ARCH, i386) {
                    DAQ_LIB_BASE_PATH=$$DAQ_LIB_ROOT_PATH/lib/x86/msvc2017
                } else {
                    DAQ_LIB_BASE_PATH=$$DAQ_LIB_ROOT_PATH/lib/x64/msvc2017
                }
            }
        }

        # 检查是否为 MSVC 2019
        greaterThan(QMAKE_MSC_VER, 1919) {
            lessThan(QMAKE_MSC_VER, 1930) {
                contains(QT_ARCH, i386) {
                    DAQ_LIB_BASE_PATH=$$DAQ_LIB_ROOT_PATH/lib/x86/msvc2019
                } else {
                    DAQ_LIB_BASE_PATH=$$DAQ_LIB_ROOT_PATH/lib/x64/msvc2019
                }
            }
        }
    }

    contains(QMAKE_CXX, "g++") {
        contains(QT_ARCH, i386) {
            DAQ_LIB_BASE_PATH=$$DAQ_LIB_ROOT_PATH/lib/x86/mingw810
        } else {
            DAQ_LIB_BASE_PATH=$$DAQ_LIB_ROOT_PATH/lib/x64/mingw810
        }
    }

    message($$DAQ_LIB_BASE_PATH)
    LIBS += -L$${DAQ_LIB_BASE_PATH} -l$$DAQ_LIB_NMAE
}
unix{
    DAQ_LIB_ROOT_PATH=$$DAQ_LIB_ROOT_PATH/Linux/libdaq
    DAQ_LIB_BASE_PATH=$$DAQ_LIB_ROOT_PATH/lib/x86_64/
    message($$DAQ_LIB_BASE_PATH)
    LIBS += -L$${DAQ_LIB_BASE_PATH} -l$$DAQ_LIB_NMAE
}
INCLUDEPATH += $${DAQ_LIB_ROOT_PATH}/include
INCLUDEPATH += $${DAQ_LIB_ROOT_PATH}/third_party/include
DEPENDPATH += $${DAQ_LIB_ROOT_PATH}/include
DEPENDPATH += $${DAQ_LIB_ROOT_PATH}/third_party/include

DEFINES += USE_DAQ331M

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
